package demo1;

public class Test {
    public static void main(String[] args) {
        Person person1 = new Person("bit",10);
        Person person2 = new Person("hello", 5);


        /*if(person1 > person2){

        }*/

        int ret = person1.compareTo(person2);
        if(ret > 0){
            System.out.println("person1 > person2");
        }
        NameCompare namecompare = new NameCompare();
        int i = namecompare.compare(person1,person2);
        if (i > 0) {
            System.out.println("peron1 > person2");
        }else{
            System.out.println("person1<= person2");
        }
        System.out.println("======================");
        AgeCompare agecompare = new AgeCompare();
        int j = agecompare.compare(person1,person2);
        if (j > 0) {
            System.out.println("peron1 > person2");
        }else{
            System.out.println("person1<= person2");
        }
    }
}
